﻿using System;
using System.Collections.Generic;
using System.Linq;
using Autodesk.Revit.DB;

namespace HYLightingEquipmentLay.CommonUtils
{
	public class DocumentElementUtils
	{
		public static List<T> GetSpecifyElements<T>(Autodesk.Revit.DB.Document doc)
		{
			Type typeFromHandle = typeof(T);
			FilteredElementCollector filteredElementCollector = new FilteredElementCollector(doc);
			filteredElementCollector.OfClass(typeFromHandle);
			return filteredElementCollector.Cast<T>().ToList<T>();
		}

		public static List<T> GetSpecifyElements<T>(Autodesk.Revit.DB.Document doc, ElementId viewId)
		{
			Type typeFromHandle = typeof(T);
			FilteredElementCollector filteredElementCollector = new FilteredElementCollector(doc, viewId);
			filteredElementCollector.OfClass(typeFromHandle);
			return filteredElementCollector.Cast<T>().ToList<T>();
		}
	}
}
